package com.hddz.acquisition.view;

import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.widget.ImageView;

public class MenuOnPageChangeListener implements OnPageChangeListener {

	private ImageView points[];
	private int currIndex;

	public MenuOnPageChangeListener(ImageView[] points) {
		this.points = points;
		currIndex = 0;
		points[currIndex].setEnabled(false);// 设置首页为当前页(小点着色,蓝色)
	}
	
	public int getCurrIndex(){
		return this.currIndex;
	}
	
	@Override
	public void onPageSelected(int position) {
		System.out.println(position + "currenIndex:" + currIndex);
		points[position].setEnabled(false);// 不可点
		points[currIndex].setEnabled(true);// 恢复之前页面状态
		currIndex = position;
	}

	@Override
	public void onPageScrolled(int arg0, float arg1, int arg2) {
	}

	@Override
	public void onPageScrollStateChanged(int arg0) {
	}
}